import { App } from 'vue';
import { registerControlProvider } from '@ibiz-template/runtime';
import { withInstall } from '@ibiz-template/vue3-util';
import { OdooChartControl } from './odoo-chart';
import { OdooChartProvider } from './odoo-chart.provider';

export const IBizOdooChartControl = withInstall(
  OdooChartControl,
  function (v: App) {
    v.component(OdooChartControl.name!, OdooChartControl);
    registerControlProvider('CUSTOM_ODOO_CHART', () => new OdooChartProvider());
  },
);

export default {
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
  install(app: App) {
    app.use(IBizOdooChartControl);
  },
};
